<%--
  Created by IntelliJ IDEA.
  User: MSH
  Date: 2019-01-09
  Time: 14:49
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>汽车品牌统计</title>
    <jsp:include page="${pageContext.request.contextPath}/common/common.jsp"/>
</head>
<body>
<!-- 为 ECharts 准备一个具备大小（宽高）的 DOM -->
<div id="main" style="width: 600px;height:400px;"></div>
<script type="text/javascript">

    // 基于准备好的dom，初始化echarts实例
    var myChart = echarts.init(document.getElementById('main'));



    $.post("/Cheliang/tong",function (data) {
        //隐藏loading
        myChart.hideLoading();
        myChart.setOption({
            title: {
                text: '按车辆品牌统计'
            },
            tooltip: {
                trigger: 'item',
                //模板变量有 {a}, {b}，{c}，{d}，{e}，分别表示系列名，数据名，数据值等
                formatter: "{a} <br/>{b}: {c}"
            },
            toolbox: {          //图表容器的右上角工具栏
                feature: {
                    dataView: {show: true, readOnly: false},
                    magicType: {show: true, type: ['line', 'bar']},
                    restore: {show: true},
                    saveAsImage: {show: true}
                }
            },
            legend: {
                data:['汽车名称']
            },
            xAxis: {
                data: data.xq
            },
            yAxis: {},
            series: [{
                name: '数量',
                type: 'bar',
                data: data.xqc
            }]
        });
    })
</script>
</body>
</html>
